<?php ob_start();?>
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include($root.'/standart/head.php');
include($root.'/standart/dateHeader.php');
include($root.'/standart/checkUser.php');
$db = connect();
$bgn_date = "";
$tmpDate = $_GET["DATE"];
if($tmpDate <> ""){
	list($gun,$ay,$yil) = explode('/',$tmpDate);
	$bgn_date = $yil.'-'.$ay.'-'.$gun;
}
$stmt ="SELECT PRODUCT_NAME, NOTES, MENU_ID, FIX_MENU.ID AS ID, FIX_MENU.CATEGORY_ID AS CATEGORY
			FROM FIX_MENU, MENU
			WHERE FIX_MENU.MENU_ID = MENU.ID
			AND MENU_DATE = '".$bgn_date."'";
$res = $db->query($stmt) or die($stmt."<br/><br/>".mysql_error());
	?>
	<table class="table table-striped table-bordered table-hover" id="dataTables">
		<thead>
        	<tr>
            	<th style="width: 5%;" nowrap="nowrap">Seç</th>
            	<th style="width: 25%;" nowrap="nowrap">Yemek Adı</th>
				<th style="width: 50%;" nowrap="nowrap">Açıklama</th>
                <th style="width: 20%;" nowrap="nowrap">Kategori</th>
                <th style="display: none;">MENU_ID</th>
                <th style="display: none;">ID</th>
            </tr>
		</thead>
        <tbody>
        <?php $odd = true; ?>
       	<?php while($row = $res->fetch_assoc()){?>
        	<tr class="<?php echo $odd ? "odd" : "even";?> " style="cursor: pointer;">
	            <td><input type="checkbox" /></td>
	            <td><?php echo $row["PRODUCT_NAME"];?></td>
	            <td><?php echo $row["NOTES"];?></td>
	            <td>
	            	<select class="form-control">
	            		<option value="1" <?php if($row["CATEGORY"] == "1"){ echo "selected";}?>>Çorba</option>
	            		<option value="2" <?php if($row["CATEGORY"] == "2"){ echo "selected";}?>>Ara Sıcak</option>
	            		<option value="3" <?php if($row["CATEGORY"] == "3"){ echo "selected";}?>>Ana Yemek</option>
	            		<option value="4" <?php if($row["CATEGORY"] == "4"){ echo "selected";}?>>İkram</option>
	            	</select>
	            </td>
                <td style="display: none;"><?php echo $row["MENU_ID"];?></td>
                <td style="display: none;"><?php echo $row["ID"];?></td>
			</tr>
			<?php $odd = !$odd;?>
		<?php }?>
		</tbody>
     </table>
	<?php 
$res->close();
disconnect($db);
?>
<?php ob_end_flush(); ?>